﻿@model GameSchoolApplication.Models.CourseLevel
<input type="hidden" id="navString" value="course" />
<input type="hidden" id="ID" value="@Model.cID" />
<div id="levelIndex">
    <input type="hidden" id="levelID" value=@Model.lvlID />
    <input type="hidden" id="courseID" value=@Model.cID />
    <!--course materials top navigation bar-->
    <div id="levelNavigationBar">
    </div>
    @Html.ActionLink("Búa til Verkefni", "addAssignment", new { levelID = Model.lvlID }) -
    @Html.ActionLink("Búa til Próf", "addExam", new { levelID = Model.lvlID }) -
    @Html.ActionLink("Búa til Fyrirlestur", "uploadLecture", "Material", new { levelID = Model.lvlID }, null)

    <h2>@Model.name</h2>
    <!--course materials display-->
    <h3>
        Fyrirlestrar</h3>
    <div id="materialTracker">
        <ul id="lectList">
    </div>
    <!--assignment display-->
    <h3>
        Verkefni</h3>
    <div id="assBox">
        <ul id="assList">
        </ul>
    </div>
    <!--exam display-->
    <div id="exBox">
    </div>
    <!--achievement display-->
    <div id="achivementBox">
    </div>
</div>


<script id="assListItemTemplate" type="text/html">
    <li><a href="/Assignment/getAssignment?ID=${assID}">${assName} ${pointValue}</a></li>
</script>
<script id="lectureListItemTemplate" type="text/html">
    <li><a href="/Material/getLecture?lectureID=${lectureID}">${lectureName}</a></li>
</script>
<!--AJAX föll sem hlaða inn gögnum á mismunandi stafi-->
<script type="text/javascript">
    $(document).ready(function () {
        var lvlID = $("input#levelID").val();
        var param = { levelID: lvlID }
        $.getJSON("/Assignment/getLevelAssignmentList", param, function (data) {
            $("#assListItemTemplate").tmpl(data).appendTo("#assList");
        });
    });
</script>
<script type="text/javascript">
    $(document).ready(function () {
        var lvlID = $("input#levelID").val();
        var param = { levelID: lvlID }
        $.getJSON("/Material/getLevelLectureList", param, function (data) {
            $("#lectureListItemTemplate").tmpl(data).appendTo("#lectList");
        });
    });
</script>
